//
// IUT de Nice / Departement informatique / Module APO Java
// Annee 2011_2012 
//
// Projet Himalaya
//
// Classe Region - Tests unitaires des methodes heritees de object
//                  
// Auteur : T. Cazorla & Y. Seree
// Version 1.0.0
//

import java.util.ArrayList;
import java.util.LinkedHashMap; 

public class T_Region_N3 {

   public static void main (String[] args) {

      Tests.Begin("_Himalaya.Region", "1.0.0");

  			ArrayList<Village> village = new ArrayList<Village>();
  			LinkedHashMap<String, Integer> Delegation = new LinkedHashMap<String, Integer>();
  			LinkedHashMap<String, Integer> Delegation2 = new LinkedHashMap<String, Integer>();
	
	  		Village v1 = new Village("a");
	  		Village v2 = new Village("b");
	  		Village v3 = new Village("c");
	  	
	  		village.add(v1);
	  		village.add(v2);
	  		village.add(v3);
	
	  		ArrayList<Village> village2 = new ArrayList<Village>();
	  	
	  		Village v4 = new Village("d");
	  		Village v5 = new Village("e");
	  		Village v6 = new Village("f");
	  	
	  		village2.add(v4);
	  		village2.add(v5);
	  		village2.add(v6);
	
	  		ArrayList<Village> village3 = new ArrayList<Village>();
	  	  	
	  		Village v7 = new Village("g");
	  		Village v8 = new Village("h");
	  		Village v9 = new Village("i");
	  	
	  		village3.add(v7);
	  		village3.add(v8);
	  		village3.add(v9);

        	Delegation.put("Bleu", new Integer(4));
        	Delegation.put("Rouge", new Integer(2));
        	Delegation.put("Vert", new Integer(2));
        	Delegation.put("Blanc", new Integer(3));
        	Delegation.put("Jaune", new Integer(0));
    		Delegation.put("Violet", new Integer(7));
    		
        	Delegation2.put("Bleu", new Integer(1));
        	Delegation2.put("Rouge", new Integer(2));
        	Delegation2.put("Vert", new Integer(4));
        	Delegation2.put("Blanc", new Integer(0));
        	Delegation2.put("Jaune", new Integer(8));
    		Delegation2.put("Violet", new Integer(5));
			
        Tests.Design("Controle des methodes heritees de object", 3); {

            Tests.Case("Methode clones"); {
            	
            	Region r1 = new Region(9, village, Delegation);
            	Region r2 = new Region(7, village2,Delegation2);
            	
				Tests.Unit("Region [numero=9, villages=[a, b, c], Delegation={Rouge=2, Blanc=3, Bleu=4, Vert=2, Violet=7, Jaune=0}]",  ((Region)r1.clone()).toString());
				Tests.Unit("Region [numero=7, villages=[d, e, f], Delegation={Rouge=2, Blanc=0, Bleu=1, Vert=4, Violet=5, Jaune=8}]",  ((Region)r2.clone()).toString());
            }

            Tests.Case("Methode equals"); {
                Region r1 = new Region(8, village, Delegation);
                Region r2 = new Region(2, village2, Delegation2);
                Region r3 = new Region(2, village3, Delegation);
                Region r4 = new Region(8, village, Delegation);
                Region r5 = new Region(2, village3, Delegation);

            	Tests.Unit(false, r1.equals(r2));
                Tests.Unit(false, r2.equals(r3));
                Tests.Unit(true,  r1.equals(r4));
                Tests.Unit(false, r3.equals((Region)r4.clone()));
                Tests.Unit(true,  r3.equals(r5));
                Tests.Unit(true,  r1.equals((Region)r1.clone()));
                Tests.Unit(true,  r1.equals((Region)r4.clone()));
            }
         }
      Tests.End();
   }
}